<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>


<script>
    //基础运算符
    let num = 12
    num += 3
    console.log(num);
    // 一元运算符
    // 1.前置自增和后置自增，相当于+=1，每次变量加1
    // let i = 1
    // ++i
    // console.log(i);

    //<!-- ----------------------------------------------------------------------- -->

    // let e = 1
    // e++
    // console.log(e);

    // 两者区别，++1是先加后运算，i++是先运算后加,i++用的多，单独使用，经常用于计数
    let i = 1
    console.log(++i + 2);  // 4

    //<!-- ----------------------------------------------------------------------- -->

    let e = 1
    console.log(e++ + 2);   //3

    //<!-- ----------------------------------------------------------------------- -->

    //  了解
    let w=1
    console.log(w++ + ++w + w);     //7
</script>
</body>

</html>